home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / UPC12BS2.ZIP / UTIL / UUPOLL.C < prev   
C/C++ Source or Header  |  1993-09-26  |  38KB  |  1,026 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    Program:    uupoll.c              22 September 1989             */
  3. /*    Author:     Andrew H. Derbyshire                                */
  4. /*                Kendra Electronic Wonderworks                       */
  5. /*                P.O. Box 132                                        */
  6. /*                Arlington, MA 02174                                 */
  7. /*    Internet:   help@kew.com                                        */
  8. /*    Function:   Performs autopoll functions for UUCICO              */
  9. /*    Language:   Borland C++ 3.1                                     */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. /*--------------------------------------------------------------------*/
  13. /*       Changes Copyright (c) 1989-1993 by Kendra Electronic         */
  14. /*       Wonderworks.                                                 */
  15. /*                                                                    */
  16. /*       All rights reserved except those explicitly granted by       */
  17. /*       the UUPC/extended license agreement.                         */
  18. /*--------------------------------------------------------------------*/
  19.  
  20. /*--------------------------------------------------------------------*/
  21. /*    Usage:      uupoll [-r 0] [-f hhmm] [-i hhmm|0400 ]             */
  22. /*                       [-d hhmm] [-e hhmm]                          */
  23. /*                       [-a hhmm] [-x debug] [-s systems]            */
  24. /*                       [-c hhmm] [-C command] [-B command]          */
  25. /*                                                                    */
  26. /*                Where:                                              */
  27. /*                                                                    */
  28. /*                -r 0     specifies that UUCICO is to run            */
  29. /*                         into passive mode when waiting to          */
  30. /*                         poll out                                   */
  31. /*                                                                    */
  32. /*                -r 1     specifies that UUCICO will not run         */
  33. /*                         in passive mode while waiting to           */
  34. /*                         poll out, but polling out will             */
  35. /*                         occur.                                     */
  36. /*                                                                    */
  37. /*                -f hhmm  is the first time in the day that          */
  38. /*                         UUCICO is to poll out.  If omitted,        */
  39. /*                         polling begins after the interval          */
  40. /*                         specified with -i.                         */
  41. /*                                                                    */
  42. /*                -i hhmm  the interval the UUCICO is to poll         */
  43. /*                         out at.  If omitted, a period of 4         */
  44. /*                         hours will be used.                        */
  45. /*                                                                    */
  46. /*                -d hhmm  Terminate polling after hhmm.              */
  47. /*                         Default is not to terminate.               */
  48. /*                                                                    */
  49. /*                -e hhmm  Terminate polling at hhmm                  */
  50. /*                         Default is not to terminate.               */
  51. /*                                                                    */
  52. /*                -a hhmm  Automatically poll actively using the      */
  53. /*                         system name "any" after any                */
  54. /*                         successful inbound poll if hhmm have       */
  55. /*                         past since last poll.  hhmm may be         */
  56. /*                         0000.                                      */
  57. /*                                                                    */
  58. /*                -c hhmm  Run a command at hhmm to clean the UUPC    */
  59. /*                         spool at this time every day.  Default is  */
  60. /*                         never.                                     */
  61. /*                                                                    */
  62. /*                -C cmd   Run command 'cmd' at the specified by      */
  63. /*                         -c.  The default is UUCLEAN.               */
  64. /*                                                                    */
  65. /*                -B cmd   Run command cmd before each active call    */
  66. /*                         out to batch up any work.  Default is      */
  67. /*                         run nothing.                              */
  68. /*                                                                    */
  69. /*                In addition, the following flags will be passed     */
  70. /*                to UUCICO:                                          */
  71. /*                                                                    */
  72. /*                -s system      system name to poll.  By default,    */
  73. /*                               UUCICO will be invoked with          */
  74. /*                               '-s all' followed by '-s any'.       */
  75. /*                                                                    */
  76. /*                -x n           debug level.   The default level     */
  77. /*                               is 1.                                */
  78. /*--------------------------------------------------------------------*/
  79.  
  80. /*--------------------------------------------------------------------*/
  81. /*                          RCS Information                           */
  82. /*--------------------------------------------------------------------*/
  83.  
  84. /*
  85.  *    $Id: uupoll.c 1.14 1993/09/27 00:45:20 ahd Exp $
  86.  *
  87.  *    $Log: uupoll.c $
  88.  * Revision 1.14  1993/09/27  00:45:20  ahd
  89.  * Make command syncs to get around bug in execute() under OS/2
  90.  *
  91.  * Revision 1.13  1993/09/20  04:41:54  ahd
  92.  * OS/2 2.x support
  93.  *
  94.  * Revision 1.12  1993/07/31  16:26:01  ahd
  95.  * Changes in support of Robert Denny's Windows support
  96.  *
  97.  * Revision 1.11  1993/07/19  02:52:11  ahd
  98.  * Up memory access room
  99.  *
  100.  * Revision 1.10  1993/06/06  15:04:05  ahd
  101.  * Allow for batch command to run before regularly scheduled poll out
  102.  *
  103.  * Revision 1.9  1993/05/13  01:39:04  ahd
  104.  * Additional fix for correctly handling UUCLEAN once and only once daily
  105.  *
  106.  * Revision 1.8  1993/05/11  03:25:17  ahd
  107.  * Don't loop when sleeping for autoclean -- get it over with
  108.  *
  109.  * Revision 1.7  1993/04/14  10:29:53  ahd
  110.  * Correct invalid exit time if both -e and -f flags specified
  111.  *
  112.  * Revision 1.6  1993/04/10  21:25:16  dmwatt
  113.  * Add Windows/NT support
  114.  *
  115.  * Revision 1.6  1993/04/10  21:25:16  dmwatt
  116.  * Add Windows/NT support
  117.  *
  118.  * Revision 1.5  1993/04/04  04:57:01  ahd
  119.  * Return exit code of UUCICO upon exit
  120.  *
  121.  * Revision 1.4  1993/03/06  23:04:54  ahd
  122.  * Add cr after auto-clean message
  123.  *
  124.  * Revision 1.3  1992/11/20  12:41:01  ahd
  125.  * Fix TZ change bug
  126.  *
  127.  * Revision 1.2  1992/11/15  04:45:46  ahd
  128.  * Correct polling for days time zone changes
  129.  *
  130.  * Revision 1.1  1992/11/15  04:29:22  ahd
  131.  * Initial revision
  132.  *
  133.  * Revision 1.1  1992/04/27  00:30:13  ahd
  134.  * Initial revision
  135.  *
  136.  */
  137.  
  138. static const char rcsid[] =
  139.          "$Id: uupoll.c 1.14 1993/09/27 00:45:20 ahd Exp $";
  140.  
  141. /*--------------------------------------------------------------------*/
  142. /*                        System include file                         */
  143. /*--------------------------------------------------------------------*/
  144.  
  145. #include <ctype.h>
  146. #include <dos.h>
  147. #include <limits.h>
  148. #include <process.h>
  149. #include <stdio.h>
  150. #include <stdlib.h>
  151. #include <string.h>
  152. #include <time.h>
  153. #include <conio.h>
  154. #include <direct.h>
  155. #include <signal.h>           /* Ctrl-Break handler               */
  156.  
  157. #if  defined(WIN32) || defined(FAMILYAPI) || defined(_Windows) || defined(__OS2__)
  158. #define NOCBREAK
  159. #elif defined(__TURBOC__)
  160. #include <alloc.h>
  161. unsigned _stklen = 3172;            /* R